package com.github.ghsea.cc.service.db;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.ghsea.cc.module.Rule;
import com.github.ghsea.cc.repository.RuleDao;

@Service
public class RuleServiceImpl implements RuleService {

	@Resource
	private RuleDao ruleDao;
	public List<Rule> getAllRules() {
		return ruleDao.getAllRules();
		
/*		List<Rule> dummyRules = Lists.newArrayList();
		Rule r1 = new Rule();
		r1.setDuration(1);
		r1.setDurationType(0);
		r1.setMaxTimes(5);
		r1.setId(1L);
		r1.setUrlPattern("/index*");
		r1.setIsDeleted(0);
		dummyRules.add(r1);
		
		Rule r2 = new Rule();
		r2.setDuration(5);
		r2.setDurationType(0);
		r2.setMaxTimes(10);
		r2.setId(1L);
		r2.setUrlPattern("/test2/*");
		r2.setIsDeleted(0);
		dummyRules.add(r2);
		
		return dummyRules;*/
	}

	public List<Rule> getUpdatedRules(Date updateTime) {
		
		return ruleDao.getUpdatedRules(updateTime);
		
		/*
		 * List<Rule> dummyRules = Lists.newArrayList(); Rule r1 = new Rule();
		 * r1.setDuration(1); r1.setDurationType(0); r1.setMaxTimes(5);
		 * r1.setId(1L); r1.setUrlPattern("/test/*"); r1.setIsDeleted(0);
		 * dummyRules.add(r1);
		 * 
		 * Rule r2 = new Rule(); r2.setDuration(5); r2.setDurationType(0);
		 * r2.setMaxTimes(10); r2.setId(1L); r2.setUrlPattern("/test2/*");
		 * r2.setIsDeleted(1); dummyRules.add(r2);
		 * 
		 * return dummyRules;
		 */
	}

}
